package cn.taketoday.live;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

import cn.taketoday.live.service.SettingsService;
import cn.taketoday.live.service.impl.SetServiceImpl;

/**
 * @author BanqiJane
 */
@EnableScheduling
@SpringBootApplication
public class BiliBiliApplication implements CommandLineRunner {
  private SettingsService checkService;
//  private TaskRegisterComponent taskRegisterComponent;

  public static void main(String[] args) {
    SpringApplication.run(BiliBiliApplication.class, args);
  }

  @Override
  public void run(String... args) throws Exception {
    checkService.init(0);
  }

  @Bean
  public ServerEndpointExporter serverEndpointExporter() {
    return new ServerEndpointExporter();
  }

  @Autowired
  public void setCheckService(SetServiceImpl checkService) {
    this.checkService = checkService;
  }

//  @Autowired
//  public void setTaskRegisterComponent(TaskRegisterComponent taskRegisterComponent) {
//    this.taskRegisterComponent = taskRegisterComponent;
//  }
}
